<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Team Bonus Wizard</title>
<link href="/css/template.css" rel="stylesheet" type="text/css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>
<script language ="javascript"> 

</script>
<style type="text/css">
span{
	display:none;
}
</style>
</head>

<body style="font-family:Arial, Helvetica, sans-serif">
<?php $stfBonus = new Model_Payroll_Staffbonus();
	  $cycle = unserialize(BONUS_CYCLE_2015);?>
<h1>Add Other Lost</h1>

<form action = "" method = "post">
<p>Please choose cycle</p>
	<select id = "cycle" name = "cycle">
		<option selected="selected"  value = "" disabled>Please Select</option>
		<?php foreach($cycle as $k => $v){?>
		<?php $bonusCheck = $stfBonus->listPeriodBonus($v[0], $v[1]);?>
				<option value = "<?php echo $k;?>" <?php if(!empty($bonusCheck)){?>disabled<?php }?>><?php echo $v[0];?> ~ <?php echo $v[1];?>( <?php echo $k + 1;?> ) </option>
		<?php }?>
	</select>
	<br/>
	<br/>
<p>Please choose Shop Group</p>
	<select id = "shopgroup" name = "shopgroup">
		<option selected="selected"  value = "" disabled>Please Select</option>
		<?php foreach($this->shopgroup as $k2 => $v2){?>
		<option value = "<?php echo $k2;?>"><?php echo $v2;?></option>
		<?php }?>
	</select><br/><br/>
	Amount:<input type = "text" id = "amount" name = "amount" ></input><br/><br/>
	Note:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "text" id = "note" name = "note"></input><br/><br/>
	Input password: <input type = "password" id = "password" name = "password"></input><br/><br/>
	<input type = "submit" id = "submit" name = "submit" value = "Submit" ></input><br/><br/>

	<br/>
	<br/>
	<h3>Add History</h3>
	<table border="1" cellspacing="1" cellpadding="5">
		<tr>
			<td>Shop</td>
			<td>Total Detuction</td>
			<td>Will detuct on bonus cycle</td>
			<td>Detail</td>
			<td>Autherized Person</td>
			<td colspan="3">Action</td>
		</tr>
		<?php foreach ($this->summaryLost as $k3 => $v3){?>
		<tr>
			<td><?php echo $v3['shop_code']?></td>
			<td align = "center"><?php echo $v3['amt_total_bonus']?></td>	
			<?php foreach ($cycle as $k4 => $v4){
				    if($v4[0] >= $v3['period_bonus_begin'] && $v4[1] <= $v3['Period_bonus_end']){
				    	$cycleKey = $k4 + 1;
				    }				
			}?>
			<td align = "center"><?php echo $cycleKey?>( <?php echo $v3['period_bonus_begin']?> ~~ <?php echo $v3['Period_bonus_end']?> )</td>	
			<td align = "center"><?php echo $v3['detail_bonus']?></td>
			<td align = "center"><?php echo $v3['signed_by']?></td>
			<td><?php if($v3['hold_reason'] != 1){?><input type = "submit" name = "delect[<?php echo $v3['id_bonus']?>]" id = "delect" value = "Delect" onclick="if(confirm('Are you sure')){} else {return false;};"></input><?php }else{ echo "<img src='/im/yes20.jpg' />" ;}?></td>
			<td><?php if($v3['hold_reason'] != 1){?><input type = "submit" name = "confirm[<?php echo $v3['id_bonus']?>]" id = "confirm" value = "Confirm"></input><?php }else{ echo "<img src='/im/yes20.jpg' />" ;}?></td>
			<td><?php if($v3['hold_reason'] != 1){?><input type = "password" name = "pcode[<?php echo $v3['id_bonus']?>]" ></input><?php }?></td>
		</tr>
		<?php }?>
	</table>
</form>
</body>
</html>